package demo.framework;

import org.junit.AfterClass;
import org.junit.BeforeClass;

import demo.util.BaseUtils;
import demo.util.Console;

public abstract class BaseTestCase {

    protected static final int WAITING_DELAY_SEC = 1;

    protected static Console console = BaseUtils.getConsole();

    @BeforeClass
    public static void init() {

    }

    @AfterClass
    public static void end() {
        manualBreak();
    }

    static void config() {

    }

    static void loadProperties() {
        BaseUtils.loadProperties();
    }

    protected static String getProperty(String key) {
        return BaseUtils.getProperty(key);
    }

    protected static <T> T cast(Object obj) {
        return BaseUtils.<T>cast(obj);
    }

    protected static String concat(Object... args) {
        return BaseUtils.concat(args);
    }

    protected static void manualBreak() {
//        String cmd = console.readLine();
//        if (StringUtils.endsWithIgnoreCase(cmd, "exit") || StringUtils.endsWithIgnoreCase(cmd, "quit")) {
//            throw new RuntimeException("User has stopped this operation.");
//        }
    }

}
